---
artifact: {{ $.ModuleName }}/{{ $.ImageName }}-build-artifact
from: {{ $.Images.BASE_GOLANG_21_ALPINE }}
git:
- add: /{{ $.ModulePath }}modules/{{ $.ModulePriority }}-{{ $.ModuleName }}/images/{{ $.ImageName }}
  to: /src
  excludePaths:
  - "**/*.md"
  - "**/*.yaml"
  stageDependencies:
    install:
    - go.mod
    - go.sum
    setup:
    - "**/*.go"
mount:
- fromPath: ~/go-pkg-cache
  to: /go/pkg
shell:
  install:
  - cd /src
  - go mod download
  setup:
  - export GOOS=linux GOARCH=amd64
  - export CGO_ENABLED=0
  - cd /src
  - go build -ldflags="-s -w" -o safe-agent-updater .
  - chown 64535:64535 /src/safe-agent-updater
  - chmod 0700 /src/safe-agent-updater
---
image: {{ $.ModuleName }}/{{ .ImageName }}
fromImage: common/distroless
import:
- artifact: {{ $.ModuleName }}/{{ $.ImageName }}-build-artifact
  add: /src/safe-agent-updater
  to: /safe-agent-updater
  before: install
docker:
  USER: 64535
  ENTRYPOINT: ["/safe-agent-updater"]
